package com.bohua.Car.admin.controller;

import com.bohua.Car.admin.common.Lay;
import com.bohua.Car.admin.common.Msg;
import com.bohua.Car.admin.entity.Carlook;
import com.bohua.Car.admin.service.CarlookService;
import com.bohua.Car.admin.util.FileUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.UUID;

@Controller
@RequestMapping("/url")
public class CarlookController {
  @Resource
  private CarlookService carlookService;

  @RequestMapping
    public String url(){
      return "Carlook/Carlook.html";
  }

  @RequestMapping("add")
  public  String addurl(){ return "Carlook/addUrl.html"; }

  @RequestMapping("update")
  public String updateurl(){return "Carlook/update.html"; };

  @RequestMapping("addlook")
  @ResponseBody
  public Msg addLook(Carlook carlook){return carlookService.addUrl(carlook);}

  @RequestMapping("/updatelook")
  @ResponseBody
  public Msg update(Carlook carlook){ return carlookService.update(carlook); }

  @RequestMapping("/dellook")
  @ResponseBody
  public Msg del(Carlook carlook){ return carlookService.del(carlook); }

  /**
   * 分页查询
   * @param customers
   * @param page
   * @param limit
   * @return
   */
  @RequestMapping("/geturl")
  @ResponseBody
  public Lay getTypes(Carlook customers, Integer page, Integer limit){
    return carlookService.getUrl(customers,page,limit);
  }
}
